package com.keur.money.utils.room;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;


@Database(entities = {UserEvent.class}, version = 1, exportSchema = false)
public abstract class UserBehaviorDatabase extends RoomDatabase {
    public abstract UserEventDao eventDao();

    private static volatile UserBehaviorDatabase INSTANCE;

    public static UserBehaviorDatabase getDatabase(final Context context) {
        if (INSTANCE == null) {
            synchronized (UserBehaviorDatabase.class) {
                if (INSTANCE == null) {
                    INSTANCE = Room.databaseBuilder(context.getApplicationContext(), UserBehaviorDatabase.class, "user_behavior.db").build();
                }
            }
        }
        return INSTANCE;
    }
}
